package paneles

import org.apache.wicket.markup.html.basic.Label

import org.apache.wicket.markup.html.panel.Panel
import org.uqbar.wicket.xtend.WicketExtensionFactoryMethods
import org.uqbar.wicket.xtend.XAttributeModifier
import org.uqbar.wicket.xtend.XLink
import modelo.Jugador
import org.uqbar.wicket.xtend.XListView

import modelo.Sistema
import org.apache.wicket.model.CompoundPropertyModel

class Botonera extends Panel {
	extension 	WicketExtensionFactoryMethods = new WicketExtensionFactoryMethods
	Panel panel
	
	new(String id,Jugador jugador, Panel jardin) {
		super(id)
		var sistema=new Sistema(jugador)
		this.agregaBotones(jugador,sistema)
		panel= jardin
		
		defaultModel = new CompoundPropertyModel(sistema)
	}
	
	def agregaBotones (Jugador jugador,Sistema sistema){
		

		this.addChild(
			new XLink("BotonJardin") => [
				onClick = [|panel.replaceWith(new PanelJardin("jardin", jugador))
			]
			])
			
		this.addChild(
			new XLink("BotonJardinZenT") => [
				onClick = [ | 
					panel.replaceWith(new PanelJardinZen("jardin", jugador, jugador.jardinZenTierra))
				]
			])
		this.addChild(
			new XLink("BotonJardinZenA") => [
				onClick = [ |
					panel.replaceWith(new PanelJardinZen("jardin", jugador, jugador.jardinZenAgua))
				]])
				
		this.addChild(
			new XLink("Almanaque") => [
				onClick = [ |
					panel.replaceWith(new Almanaque("jardin", jugador, jugador.jardinZenAgua,sistema))
				]])
}
}